<include file="public/header" title="{$team[share_title]}"/>
<style>
    .plus span.disable{
        cursor: default;
        color: #e9e9e9;
    }
    .shop-top-under .shulges .choic-sel a.disable {
        cursor: not-allowed;
        padding: .21333rem .46933rem;
        border: 1px dashed #DEDEDE;
        margin-right: .21333rem;
        font-size: .68267rem;
        color: #DEDEDE;
        margin-bottom: .42667rem;
        display: block;
        float: left;
    }
    .plusshopcar-buy .dis{
        background: #ebebeb;
        color: #999;
        cursor: not-allowed;
        pointer-events:none;
    }
</style>
<div class="he_sustain">
    <div class="classreturn loginsignup detail">
        <div class="content">
            <div class="ds-in-bl return">
                <a href="javascript:history.back(-1)"><img src="__STATIC__/images/return.png" alt="返回"></a>
            </div>
            <div class="ds-in-bl search center">
                <span class="sxp">商品</span>
                <span>详情</span>
                <span>评论</span>
            </div>
            <!--<a class="btn-share-ico" id="share_button" href="javascript:;"></a>-->
        </div>
    </div>
</div>
<!--顶部隐藏菜单-s-->
<include file="public/top_nav"/>
<!--顶部隐藏菜单-e-->
<div class="xq_details action-detail">
    <div class="banner ban1 detailban">
        <div class="mslide" id="slideTpshop">
            <ul>
                <foreach name="goods_images_list" item="pic">
                    <li><a href="javascript:void(0)"><img src="{$pic[image_url]}"></a></li>
                </foreach>
            </ul>
        </div>
        <!--
        <div class="jump-message">
            <div class="litsbe">
                <div class="yigsmrecan">
                    <img class="juminm" src="../images/mq.jpg"/>
							<span class="juminn">
								最新订单来自重庆的<em class="jumname">美沁</em>,<em>1</em>秒前
							</span>
                </div>
            </div>
        </div>
        -->
    </div>
    <div class="de_font p">
        <div class="thirty">
            <div class="fl">
                <span class="similar-product-text">{$goods[goods_name]}</span>
            </div>
            <div class="scunde p">
                <p class="red">￥<span class="team_price">{$team[team_price]}</span> <a class="attengro front_status_desc">{$team[front_status_desc]}</a></p>

                <p class="shdicc">市场价格：<span class="linethr">{$goods[market_price]}</span></p>
                <p class="shdicc share_desc">{$team[share_desc]}</p>
            </div>
        </div>
    </div>
    <div class="floor list7 g7">
        <div class="myhearders myorder actino-her ma-to-20" style="height: 1.92rem;">
            <div class="scgz descgz">
                <ul>
                    <li>
                        <a href="javascript:void(0);">
                            <img src="__STATIC__/images/ag.png">

                            <p>品质保障</p>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0);">
                            <img src="__STATIC__/images/ah.png">

                            <p>放心物流</p>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0);">
                            <img src="__STATIC__/images/ai.png">

                            <p>贴心服务</p>
                        </a>
                    </li>
                </ul>
            </div>
        </div>
            <div class="yixgp have_founds" style="display: none">
                <div class="maleri30">
                    <span>以下小伙伴正在发起团购，您可以直接参与</span>
                </div>
            </div>
            <div class="lesgcan have_founds" style="display: none">
                <div class="maleri30" id="found_list">
                </div>
            </div>
        <div class="shartogete ma-to-20">
            <div class="maleri30">
                <h2>拼团规则</h2>
                <ul class="forneu">
                    <li>
                        <span class="aroundu">1</span>
                        <span>选择商品</span>
                    </li>
                    <li>
                        <span class="aroundu">2</span>
                        <span>开团/参团</span>
                    </li>
                    <li>
                        <span class="aroundu">3</span>
                        <span>邀请好友</span>
                    </li>
                    <li>
                        <span class="aroundu">4</span>
                        <span>人满成团</span>
                    </li>
                </ul>
                <p class="fohe"><i class="action-al"></i></p>
            </div>
        </div>
        <div class="hs_acion">
            <div class="maleri30">
                <p>1.开团：在商城内选择喜欢的商品，点击“去开团”，付款成功后即为开团成功；</p>

                <p>2.参团：进入朋友分享的页面，点击“立即参团”，付款后即为参团成功，若多人同时支付，按先支付成功的用户获得参团资格；</p>

                <p>3.成团：在开团或参团之后,可以点击“分享出去”，在有效时间凑齐成团人数即拼团成功；</p>

                <p>4.组团失败：在有效时间内未凑齐人数，即为组团失败，此时商城会将原款分别退回；</p>
            </div>
        </div>
    </div>
</div>
<!--详情-s-->
<div class="xq_details" style="display: none;">
    <div class="spxq-ggcs">
        <ul>
            <li class="red">商品详情</li>
            <li>规格参数</li>
        </ul>
    </div>
    <div class="sg">
        <div class="spxq p">
            {$goods[goods_content]|htmlspecialchars_decode}
        </div>
    </div>
    <div class="sg" style="display: none;">
        <div class="spxq p">
            <table class="de_table" border="1" bordercolor="#cbcbcb" style="border-collapse:collapse;">
                <tr>
                    <th colspan="2">主体</th>
                </tr>
                <foreach name="goods_attr_list" item="v" key="k">
                    <tr>
                        <td>{$goods_attribute[$v[attr_id]]}</td>
                        <td>{$v[attr_value]}</td>
                    </tr>
                </foreach>
            </table>
        </div>
    </div>
</div>
<!--详情-e-->
<div class="xq_details" style="display: none;">
    <div class="spxq-ggcs comment_de p">
        <ul>
            <!--1 全部 2好评 3 中评 4差评-->
            <li class="red">全部评价 <br/><span ctype="1">{$commentStatistics.c0}</span></li>
            <li>好评 <br/><span ctype="2">{$commentStatistics.c1}</span></li>
            <li>中评 <br/><span ctype="3">{$commentStatistics.c2}</span></li>
            <li>差评 <br/><span ctype="4">{$commentStatistics.c3}</span></li>
            <li>有图 <br/><span ctype="5">{$commentStatistics.c4}</span></li>
        </ul>
    </div>
    <div class="tab-con-wrapper my_comment_list"></div>
</div>
<div class="podee actionfooer">
    <div class="cart-concert-btm p">
        <div class="fl">
            <ul>
                <li>
                    <a href="{:U('Index/index')}">
                        <em class="ico ico-index6"></em>
                        <p>首页</p>
                    </a>
                </li>
                <li>
                    <a href="javascript:collect_goods({$goods.goods_id});" id="favorite">
                        <em class="ico ico-heart <if condition='$collect gt 0'>ico-heart-h</if>" ></em>
                        <p>收藏</p>
                    </a>
                </li>
                <li>
                    <a href="tel:{$tpshop_config['shop_info_phone']}">
                        <em class="ico ico-kf6"></em>
                        <p>客服</p>
                    </a>
                </li>
            </ul>
        </div>
        <div class="fr">
            <ul>
                <li class="o">
                    <a href="{:U('Mobile/Goods/goodsInfo',['id'=>$goods[goods_id]])}">
                        单独购买<br/>
                        ￥<em>{$goods[shop_price]}</em>
                    </a>
                </li>
                <li class="r lottery" style="display: none">
                    <a id="lottery_a" href="{:U('Mobile/Team/lottery',['team_id'=>$team['team_id']])}">查看中奖名单
                        <br/>
                        ￥<em class="team_price">{$team.team_price}</em>
                    </a>
                </li>
                <li class="r no_lottery">
                    <a href="javascript:void(0);" class="choise_num">
                        <em class="needer">{$team.needer}</em>人团<br/>
                        ￥<em class="team_price">{$team.team_price}</em>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>
<!--点赞弹窗-s-->
<div class="alert">
    <img src="__STATIC__/images/hh.png"/>

    <p>您已经赞过了！</p>
</div>
<!--点赞弹窗-e-->

<!--所选弹窗-s-->
<form name="buy_goods_form" method="post" id="buy_goods_form">
    <input type="hidden" name="goods_id" value="{$team.goods_id}"/>
    <input type="hidden" name="team_id" value="{$team.team_id}"/>
    <div class="choose_shop_aready p" id="choose_spec">
        <div class="shop-top-under p">
            <div class="maleri30">
                <div class="shopprice">
                    <div class="img_or fl"><img src="{$goods.goods_id|goods_thum_images=146,146}"></div>
                    <div class="fon_or fl">
                        <h2 class="similar-product-text">{$goods[goods_name]}</h2>

                        <div class="price_or"><span>￥</span><span class="team_price">{$team[team_price]}</span>(<span class="needer">{$team[needer]}</span>人团)</div>
                        <div class="dqkc_or"><span>当前库存：</span><span class="stock" id="spec_store_count">{$goods.store_count}</span></div>
                    </div>
                    <div class="price_or fr">
                        <i class="xxgro" id="choose_spec_close"></i>
                    </div>
                </div>
            </div>
        </div>
        <div class="shop-top-under p">
            <div class="maleri30">
                <div class="shulges p">
                    <p>数量</p>

                    <div class="plus">
                        <span class="mp_minous">-</span>
                        <span class="mp_mp"> <input type="tel" class="num buyNum" id="number" residuenum="{$goods.store_count}" name="goods_num" value="1" min="1" max="{$goods.store_count}" onblur="altergoodsnum(0)"></span>
                        <span class="mp_plus">+</span>
                    </div>
                </div>
                <if condition="$filter_spec neq ''">
                    <foreach item="spec" key="key" name="filter_spec">
                        <div class="shulges p choicsel spec">
                            <p>{$key}</p>
                            <!-------商品属性值-s------->
                            <foreach name="spec" item="v2" key="k2">
                                <div class="plus choic-sel">
                                    <a id="goods_spec_a_{$v2[item_id]}" class="spec_item" title="{$v2[item]}" data-item-id="{$v2[item_id]}" <if condition="!empty($v2['src'])">$('#zoomimg').attr('src','{$v2[src]}');</if>>
                                    <input id="goods_spec_{$v2[item_id]}" type="radio" style="display:none;" name="goods_spec[{$key}]" value="{$v2[item_id]}"/>{$v2[item]}</a>
                                </div>
                            </foreach>
                            <!-------商品属性值-e-------->
                        </div>
                    </foreach>
                </if>
            </div>
        </div>
        <div class="plusshopcar-buy p">
            <a class="pb_buy dis_btn" href="javascript:void(0);" onClick="addTeamOrder();">立即购买</a>
        </div>
    </div>
</form>
<!--所选弹窗-e-->
<!--&lt;!&ndash;分享弹窗-s&ndash;&gt;-->
<!--<div class="share-bottom-wrap" id="share_bottom">-->
    <!--&lt;!&ndash; 百度分享 Button BEGIN &ndash;&gt;-->
    <!--<div class="bdsharebuttonbox" data-tag="share_1">-->
        <!--<a class="ico-share-wechat" data-cmd="weixin"></a>-->
        <!--<a class="ico-share-qq" data-cmd="sqq"></a>-->
        <!--<a class="ico-share-kj" data-cmd="qzone" href="#"></a>-->
        <!--<a class="ico-share-weibo" data-cmd="tsina"></a>-->
    <!--</div>-->
    <!--&lt;!&ndash; 百度分享 Button END &ndash;&gt;-->
    <!--<i class="xxgro" id="share_bottom_close"></i>-->
<!--</div>-->
<!--&lt;!&ndash;分享弹窗-e&ndash;&gt;-->
<div class="mask-filter-div" style="display: none;"></div>
<include file="public/wx_share"/>
<script type="text/javascript">
    var r_team_id,team_price,needer,is_lottery,front_status_desc,stock,share_title,share_desc,bd_url,bd_pic,lottery_url,time_limit;
    r_team_id = {$team_id|default=0};
    var spec_goods_price = {$spec_goods_price|default='null'};//规格库存价格
    var commentType = 1;// 默认评论类型
    $(document).ready(function () {
        initSpec();
        ajaxComment(commentType, 1);// ajax 加载评价列表
        getTeamFounds();
    });
    //有活动id的时候，解析活动id选中规格
    function initSpec() {
        var team_id = $("input[name='team_id']").val();
        if(team_id == 0 && r_team_id != 0){
            team_id = r_team_id;
        }
        $("input[name='team_id']").val(team_id);
        if (team_id > 0 && !$.isEmptyObject(spec_goods_price)) {
            var team_id_arr = [];
            $.each(spec_goods_price, function (i, o) {
                team_id_arr.push(o.team_id);
            })
            //规格id不存在商品里
            if ($.inArray(parseInt(team_id), team_id_arr) < 0) {
            } else {
                $.each(spec_goods_price, function (i, o) {
                    if (o.team_id == team_id) {
                        var spec_key_arr = o.key.split("_");
                        $.each(spec_key_arr, function (index, item) {
                            var spec_radio = $("#goods_spec_" + item);
                            var goods_spec_a = $("#goods_spec_a_" + item);
                            spec_radio.attr("checked", "checked");
                            goods_spec_a.addClass('red');
                        })
                    }
                })
            }
        } else {
        }
        initGoodsPrice();
    }
    //添加评团订单
    function addTeamOrder(){
        var spec = $('.spec');
        if(spec.length > 0 && spec.length != spec.find('.red').length){
            layer.open({content:'请选择规格',time: 2});
            return false;
        }
        var goods_num = $("input[name='goods_num']").val();
        if (goods_num <= 0) {
            layer.open({content:'请至少购买一份~',time: 2});
            return false;
        }
        $.ajax({
            type : "POST",
            url:"{:U('Mobile/Team/addOrder')}",
            dataType:'json',
            data: $('#buy_goods_form').serialize(),
            success: function(data){
                if(data.status == 1){
                    location.href = "/index.php?m=Mobile&c=Team&a=order&order_id=" + data.result.order_id; // 跳转到结算页
                }else{
                    layer.open({content:data.msg,time: 2,end:function(){
                        if(!$.isEmptyObject(data.result)){
                            if(!$.isEmptyObject(data.result.url)){
                                location.href = data.result.url;
                                return false;
                            }
                        }
                    }});
                }
            }
        });
    }
    /**
     * 加载更多评论
     */
    function ajaxComment(commentType, page) {
        var goods_id = $("input[name='goods_id']").val();
        $.ajax({
            type: "GET",
            url: "/index.php?m=Mobile&c=goods&a=ajaxComment&goods_id=" + goods_id + "&commentType=" + commentType + "&p=" + page,//+tab,
            success: function (data) {
                $(".my_comment_list").empty().append(data);
            }
        });
    }
    $(function () {
        //顶部导航切换
        $('.detail .search span').click(function () {
            $(this).addClass('sxp').siblings().removeClass('sxp');
            var a = $('.detail .search span').index(this);
            $('.xq_details').eq(a).show().siblings('.xq_details').hide();
        });
    });
    //点击收藏商品
    function collect_goods(goods_id){
        var ids = new Array();
        ids.push(goods_id);
        $.ajax({
            type : "GET",
            dataType: "json",
            url:"/index.php?m=Home&c=goods&a=collect_goods",//+tab,
            data: {goods_ids:ids},
            success: function(data){
                layer.open({content:data.msg, time:2});
                if(data.status == '1'){
                    //收藏点亮
                    $('#favorite').find('em').addClass('ico-heart-h');
                }
            }
        });
    }

    $(function () {
        ////内部导航切换
        $('.spxq-ggcs ul li').click(function () {
            $(this).addClass('red').siblings().removeClass('red');
            var sg = $('.spxq-ggcs ul li').index(this);
            $('.sg').eq(sg).show().siblings('.sg').hide()
        });

        //内部导航随鼠标滑动显示隐藏
        var h1 = $('.detail').height();
        var h2 = $('.detail').height() + $('.spxq-ggcs').height();
        var ss = $(document).scrollTop();//上一次滚轮的高度
        $(window).scroll(function () {
            var s = $(document).scrollTop();////本次滚轮的高度

            if (s < h1) {
                $('.spxq-ggcs').removeClass('po-fi');
            }
            if (s > h1) {
                $('.spxq-ggcs').addClass('po-fi');
            }
            if (s > h2) {
                $('.spxq-ggcs').addClass('gizle');
                if (s > ss) {
                    $('.spxq-ggcs').removeClass('sabit');
                } else {
                    $('.spxq-ggcs').addClass('sabit');
                }
                ss = s;
            }
        });
    });

    //查看商品详情
    $(function () {
        $('.seedeadei').click(function () {
            $('.xq_details').eq(0).hide();
            $('.xq_details').eq(1).show();
            $('body').animate({scrollTop: 0}, 0);
            $('.detail').find('.center').find('span').eq(1).addClass('sxp');
            $('.detail').find('.center').find('span').eq(0).removeClass('sxp');
        })
    });
    //评论
    $(function () {
        $('.tbv').click(function () {
            $('.xq_details').eq(0).hide();
            $('.xq_details').eq(2).show();
            $('body').animate({scrollTop: 0}, 0);
            $('.detail').find('.center').find('span').eq(2).addClass('sxp');
            $('.detail').find('.center').find('span').eq(0).removeClass('sxp');
        })
    });

    //所选
    $(function () {
        $('.choise_num').click(function () {
            cover();
            $('#choose_spec').show();
            $('.podee').hide();
        })
        $('#choose_spec_close').click(function () {
            undercover();
            $('#choose_spec').hide();
            $('.podee').show();
        })
    });
    //加减数量
    $(function () {
        $('.mp_minous').click(function () {
            var inputs = $(this).siblings('.mp_mp').find('input');
            var val = inputs.val();
            if (val > 1) {
                val--;
                inputs.val(val);
            }else if(val == 1){
                $(this).parent().find('.mp_minous').addClass('disable');
                inputs.val(val);
            }else{
                layer.open({content:'请至少购买一份~',time: 2});
            }
        })
        $('.mp_plus').click(function () {
            var inputs = $(this).siblings('.mp_mp').find('input');
            var val = inputs.val();
            val++;
            inputs.val(val);
            if(val > 1){
                $(this).parent().find('.mp_minous').removeClass('disable');
            }
        })

        $(document).on("blur", '#goods_num', function (e) {
            initDecrement();
        })
    });
    function initDecrement(){
        var goods_num = $("input[name='goods_num']");
        var goods_num_val = parseInt(goods_num.val());
        if(goods_num_val <= 0){
            layer.open({content:'请至少购买一份~',time: 2});
            $(this).val($(this).attr('value'));
        }else if(goods_num_val == 1){
            $(this).parent().find('.mp_minous').addClass('disable');
        }else{
            $(this).parent().find('.mp_minous').removeClass('disable');
        }
    }
    //点赞
    function hde() {
        setTimeout(function () {
            $('.alert').hide();
        }, 1200)
    }

    function clickful(id) {
        var i = true;
        if ($(id).find('.btn-like-icon').hasClass('like-red')) {
            $('.alert').show(200);
            $('.alert').animate({opacity: "1"}, 600, hde());
            i = false;
        }
        if (i) {
            $(id).find('.btn-like-icon').addClass('like-red');
            $(id).find('.like').addClass('like_ani');
            var num = $(id).find('.assess-btns-num');
            var data = num.attr('data');
            data = ++data;
            num.attr('data', data);
            num.html("(" + data + ")");
        }
    }
    /**
     * 规格选择
     */
    $('.choic-sel a').click(function () {
        //切换选择
        if(!$(this).hasClass('disable')){
            $(this).addClass('red').parent().siblings().find('a').removeClass('red');
        }
        if(!$(this).hasClass('disable')){
            $(this).siblings().removeClass('hover');
            $(this).addClass('hover');
            $(this).parent().parent().find('input').removeAttr('checked');
            $(this).children('input').attr('checked', 'checked');
            $('.team-pies').hide();
            //商品价格库存显示
            var spec = $('.spec');
            if(spec.length == 0 || spec.length == spec.find('.red').length){
                initGoodsPrice();
            }
        }
    });
    //拼团规则
    $('.fohe i').click(function () {
        if ($(this).hasClass('action-am')) {
            $(this).removeClass('action-am');
            $('.hs_acion').animate({height: '0', opacity: 'show'}, 'normal', function () {
                $('.hs_acion').hide();
            });
        } else {
            $(this).addClass('action-am');
            $('.hs_acion').animate({height: '10.02667rem', opacity: 'show'}, 'normal', function () {
                $('.hs_acion').show();
            });
        }
    })

    // 倒计时
    setInterval(activityTime, 1000);
    function activityTime() {
        $('.team-found').each(function(i,o){
            var end_time = $(o).find('.rest_time').data('end-time');
            var end_time_text = getOverTimeText(end_time);
            $(o).find('.rest_time').text(end_time_text);
        })
    }
    function getOverTimeText(timeStrip){
        var end_time = parseInt(timeStrip);
        var end_time_date = formatDate(end_time*1000);
        return GetRTime(end_time_date);
    }

    //初始化商品价格库存
    function initGoodsPrice() {
        var goods_id = $('input[name="goods_id"]').val();
        if (!$.isEmptyObject(spec_goods_price)) {
            var goods_spec_arr = [];
            $("input[name^='goods_spec']").each(function () {
                if($(this).attr('checked') == 'checked'){
                    goods_spec_arr.push($(this).val());
                }
            });
            if(goods_spec_arr.length == 0){
                return false;
            }
            var spec_key = goods_spec_arr.sort(sortNumber).join('_');  //排序后组合成 key
            var spec_team_id = spec_goods_price[spec_key]['team_id'];
            $('input[name=team_id]').val(spec_team_id);
        }
        var team_id =  $('input[name=team_id]').val();
        if(team_id == 0){
            $('.dis_btn').addClass('dis');
            return false;
        }
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {goods_id: goods_id, team_id: team_id},
            url: "{:U('Mobile/Team/ajaxCheckTeam')}",
            success: function (data) {
                if (data.status == 1) {
                    var goods = data.result.team.goods;
                    var spec_goods = data.result.team.spec_goods_price;
                    team_price = data.result.team.team_price;
                    needer = data.result.team.needer;
                    is_lottery = data.result.team.is_lottery;
                    front_status_desc = data.result.team.front_status_desc;
                    share_title  = data.result.team.share_title;
                    share_desc = data.result.team.share_desc;
                    bd_url = data.result.team.bd_url;
                    bd_pic = data.result.team.bd_pic;
                    lottery_url = data.result.team.lottery_url;
                    if(spec_goods){
                        stock = spec_goods.store_count;
                    }else{
                        stock = goods.store_count;
                    }
                    goods_activity_theme();
                }
            }
        });
    }
    //获取可拼单列表
    function getTeamFounds() {
        var goods_id =  $('input[name=goods_id]').val();
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {goods_id: goods_id},
            url: "{:U('Mobile/Team/ajaxTeamFound')}",
            success: function (data) {
                if (data.status == 1) {
                    var founds = data.result.teamFounds;
                    var html = '', end_time,url;
                    for(var i = 0;i < founds.length;i++){
                        end_time = parseInt(founds[i].found_time) + parseInt(founds[i].time_limit);
                        url = "/index.php?m=Mobile&c=Team&a=found&id=" + founds[i].found_id;
                        html += '<div class="box-lesc team-found"> <div class="diff_img"> <img src="'+founds[i].head_pic+'"/> ' +
                                '</div> <div class="diff_lrzy"> <ul class="f_name_add"> <li class="nameli">' +
                                '<span>'+founds[i].nickname+'</span></li> <li class="addci"><span>'+founds[i].address_region+'</span>' +
                                '</li> </ul> <ul class="f_crou_tim"> <li class="red"><span>还差<em>'+founds[i].surplus+'</em>人成团</span>' +
                                '</li> <li class="koes"><span>剩余<em class="rest_time" data-end-time="'+end_time+'">00:00:00</em>结束</span>' +
                                '</li> </ul> </div> <div class="diff_ct"> <a href="'+url+'">去参团 <i class="w-re"></i></a> </div> </div>';
                    }
                    if(html != ''){
                        $('.have_founds').show();
                        $('#found_list').empty().append(html);
                    }else{
                        $('.have_founds').hide();
                    }
                }
            }
        });
    }
    //商品价格库存显示
    function goods_activity_theme(){
        if(is_lottery ==1){
            $('.lottery').show();
            $('.no_lottery').hide();
            $('#lottery_a').attr('lottery_a',lottery_url);
        }else{
            $('.lottery').hide();
            $('.no_lottery').show();
        }
        $('.team_price').html(team_price);
        $('.front_status_desc').html(front_status_desc);
        $('.needer').html(needer);
        $('.stock').html(stock);
        $('.share_desc').html(share_desc);
        $('#number').attr('residuenum',stock);
        if (stock <= 0) {
            $('.dis_btn').addClass('dis');
            $('.buyNum').val(stock);
        } else {
            $('.dis_btn').removeClass('dis');
            $('.buyNum').val(1);
        }
    }
    function sortNumber(a, b) {
        return a - b;
    }

</script>
<!--<script>-->
    <!--//分享-->
    <!--$(function () {-->
        <!--$('#share_button').click(function () {-->
            <!--cover();-->
            <!--$('#share_bottom').addClass('share-bottom-show');-->
        <!--})-->
        <!--$('#share_bottom_close').click(function () {-->
            <!--undercover();-->
            <!--$('#share_bottom').removeClass('share-bottom-show');-->
        <!--})-->
    <!--});-->
    <!--function setShareConfig(id,config){-->
        <!--config.bdText = share_desc;-->
        <!--config.bdDesc = share_title;-->
        <!--config.bdUrl = bd_url;-->
        <!--config.bdPic = bd_pic;-->
        <!--return config;-->
    <!--}-->
    <!--window._bd_share_config = {-->
        <!--common : {-->
            <!--//此处放置通用设置-->
            <!--onBeforeClick:setShareConfig,-->
            <!--bdText : "",-->
            <!--bdDesc : "",-->
            <!--bdUrl : "",-->
            <!--bdPic : ""-->
        <!--},-->
        <!--share : [{-->
            <!--"bdSize" : 32-->
        <!--}],-->
        <!--image : [{-->
            <!--viewType : 'list',-->
            <!--viewPos : 'top',-->
            <!--viewColor : 'black',-->
            <!--viewSize : '32',-->
            <!--viewList : ['weixin','sqq','qzone','tsina']-->
        <!--}],-->
        <!--selectShare : [{-->
            <!--"bdselectMiniList" : ['weixin','sqq','qzone','tsina']-->
        <!--}]-->
    <!--}-->
    <!--with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];-->
<!--</script>-->
</body>
</html>
